package cc.geguol.iodemo.writer;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

/**
 * 作者：13687
 * 日期：2017/6/17
 * 项目：IODemo
 * 描述：复制文本文件
 */
public class TextCopy {
	public static void main(String[] args) throws IOException {
		FileReader fileReader = new FileReader("fileWriterDemo.md");
		FileWriter fileWriter = new FileWriter("fileCopyDemo.txt",true);

		/**
		 * 通常是一边读，一边写
		 * */
		char[] buff = new char[1024];

		while (fileReader.read(buff)!=-1){
			fileWriter.write(buff,0,buff.length);
		}

		if (fileReader != null) {
			fileReader.close();
		}

		if (fileWriter != null) {
			fileWriter.close();
		}
	}
}
